<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>批单表 管理</title>
    <style type="text/css">
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <div class="searchArea">
        <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox">
                    <div class="label">名称</div>
                    <div class="field">
                        <input name="" id="" type="text" class="ui-textbox" value="">
                    </div>
                </div>

                <div class="clearFix"></div>
                <div class="btnsBox">
                    <span id="searchBtn" class="sq-button sq-button-hasicon"><i class="sqBtnIco_1"></i>查询</span>
                    <span id="clearBtn" class="sq-button sq-button-hasicon"><i class="sqBtnIco_19"></i>清空</span>
                    <span id="addBtn" class="sq-button sq-button-hasicon"><i class="sqBtnIco_3"></i>新增</span>
                    <span id="changeBtn" class="sq-button sq-button-hasicon"><i class="sqBtnIco_4"></i>修改</span>
                    <span id="delBtn" class="sq-button sq-button-hasicon"><i class="sqBtnIco_7"></i>删除</span>
                    <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
                </div>
            </div>
        </form>
    </div>
    <div id="ligergrid1" class="sq-grid"></div>
</div>

<script type="text/javascript">
    var grid = null, menu = null;
    $(function () {
        grid = $("#ligergrid1").ligerGrid({
            url: '<%=path%>/insurance/insPlcAppr/initList.do',
            method: 'get',
            columns: [
                {display: '批单单号', name: 'apprCode', minWidth: 100, align: 'left', enabledSort: true},
		{display: '保单ID', name: 'plcId', minWidth: 100, align: 'left', enabledSort: true},
		{display: '保单编号', name: 'insNo', minWidth: 100, align: 'left', enabledSort: true},
		//{display: '保险种类INS0007：1商业险2交强险3财产险4承运险
', name: 'insTypCdNm', minWidth: 100, align: 'left', enabledSort: true},
		{display: '保险公司ID', name: 'insCompId', minWidth: 100, align: 'left', enabledSort: true},
		{display: '保险支公司ID', name: 'insCompSubId', minWidth: 100, align: 'left', enabledSort: true},
		{display: '保险支公司名称', name: 'insCompSubNm', minWidth: 100, align: 'left', enabledSort: true},
		//{display: '保险购买方式INS0010：1我司购买2客户自购 3经销商代购4特殊渠道
', name: 'buyWayCdNm', minWidth: 100, align: 'left', enabledSort: true},
		{display: '投保人', name: 'perNm', minWidth: 100, align: 'left', enabledSort: true},
		{display: '投保人地址', name: 'perAddr', minWidth: 100, align: 'left', enabledSort: true},
		{display: '投保人证件号', name: 'perCretNo', minWidth: 100, align: 'left', enabledSort: true},
		{display: '被保险人', name: 'insPerNm', minWidth: 100, align: 'left', enabledSort: true},
		{display: '被保险人地址', name: 'insPerAddr', minWidth: 100, align: 'left', enabledSort: true},
		{display: '被保险人证件号码', name: 'insPerCretNo', minWidth: 100, align: 'left', enabledSort: true},
		{display: '第一受益人', name: 'fstPer', minWidth: 100, align: 'left', enabledSort: true},
		{display: '保费总金额', name: 'insTtlFee', minWidth: 100, align: 'left', enabledSort: true},
		{display: '不计免赔总金额', name: 'deduTtlAmt', minWidth: 100, align: 'left', enabledSort: true},
		{display: '车船税总金额', name: 'taxTtlAmt', minWidth: 100, align: 'left', enabledSort: true},
		{display: '新产品购置价', name: 'newPrc', minWidth: 100, align: 'left', enabledSort: true},
		//{display: '保单状态INS0001： 10流程中20正常30作废
', name: 'plcStsCdNm', minWidth: 100, align: 'left', enabledSort: true},
		//{display: '保单结算状态INS0002：10未开始 20未结算 30待确认 40已结算
', name: 'stlStsCdNm', minWidth: 100, align: 'left', enabledSort: true},
		{display: '结算时间', name: 'stlTm', minWidth: 100, align: 'left', enabledSort: true},
		{display: '结算比例', name: 'stlRat', minWidth: 100, align: 'left', enabledSort: true},
		{display: '结算金额', name: 'stlAmt', minWidth: 100, align: 'left', enabledSort: true},
		{display: '保单起始时间', name: 'plcBgTm', minWidth: 100, align: 'left', enabledSort: true},
		{display: '保单结束时间', name: 'plcEndTm', minWidth: 100, align: 'left', enabledSort: true},
		//{display: '保单期限INS0004：1分年2全部购买', name: 'plcExpCdNm', minWidth: 100, align: 'left', enabledSort: true},
		//{display: '保单性质INS0003：1首年保单2续保保单', name: 'plcPropCdNm', minWidth: 100, align: 'left', enabledSort: true},
		{display: '备注', name: 'plcRem', minWidth: 100, align: 'left', enabledSort: true},
		{display: '流程实例ID', name: 'pInstId', minWidth: 100, align: 'left', enabledSort: true},
		//{display: '保险产品类型INS0005', name: 'plcTypCdNm', minWidth: 100, align: 'left', enabledSort: true},
		{display: '客户ID', name: 'cstId', minWidth: 100, align: 'left', enabledSort: true},
		{display: '客户名称', name: 'cstNm', minWidth: 100, align: 'left', enabledSort: true},
		{display: '所属客户经理', name: 'cstMgrId', minWidth: 100, align: 'left', enabledSort: true},
		{display: '所属客户经理名称', name: 'cstMgrNm', minWidth: 100, align: 'left', enabledSort: true},
		//{display: '客户经理组织架构代码', name: 'cstMgrOrgCdNm', minWidth: 100, align: 'left', enabledSort: true},
		//{display: '所属事业部（组织架构）', name: 'buOrgCdNm', minWidth: 100, align: 'left', enabledSort: true},
		
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            //isScroll: false,
            checkbox: true,
            rownumbers: true,
            allowUnSelectRow: true,
            alternatingRow: false
            /* onRenderComplete: function () {
             iframeResize ();
             } */
        });
        grid.setHeight(100);

        $("#searchBar").ligerForm();

        $("#pageloading").hide();

        /* 查询 */
        $("#searchBtn").click(function (event) {
            var form = liger.get("searchBar");
            var data = form.getData();
            for (name in data) {
                grid.setParm(name, data[name]);
            }
            grid.reload();
        });

        /* 清空 */
        $("#clearBtn").click(function (event) {
            $("#resetBtn").click();  //重置 input-text
            var form = liger.get("searchBar");
            form.setData({  //重置select等特殊表单
                "*Cd": " "
            });
        });
        
        var callback = function () {
            grid.reload();
        };

        /* 新增 */
        $("#addBtn").click(function (event) {
            $.ligerDialog.open({
                cls: 'noBorder_Dialog',
                width: 550,
                height: 500,
                title: '新增批单表',
                url:'<%=path%>/insurance/insPlcAppr/toAddPage.do'
            });
            //Add_navTab("InsPlcAppr_1", "新增批单表", '<%=path%>/insurance/insPlcAppr/toAddPage.do', callback);
        });

        /* 修改 */
        $("#changeBtn").click(function (event) {
            var selectedRows = grid.getSelectedRows();
            if (selectedRows.length != 1) {
                $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_SELECT_ONLY_A_ROW, SQ_type: "warning"});
                return;
            }
            var _id=selectedRows[0].id;
            $.ligerDialog.open({
                cls: 'noBorder_Dialog',
                width: 550,
                height: 500,
                title: '修改批单表',
                url:'<%=path%>/insurance/insPlcAppr/toModifyPage.do?id='+_id
            });
            //Add_navTab('InsPlcAppr_2'+_id, "修改批单表", '<%=path%>/insurance/insPlcAppr/toModifyPage.do?id='+_id, callback);
        });

        /* 删除 */
        $("#delBtn").click(function () {
            var selectedRows = grid.getSelectedRows();
            if (selectedRows.length == 0) {
                $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_SELECT_MORE_ROW, SQ_type: "warning"});
                return;
            }
            var _ids = [];
            for (var index in selectedRows) {
                _ids.push(selectedRows[index].id);
            }

            $.ligerDialog.confirm(LogUtils.LOG_CMM_DELETE_CONFIRM, function (flag) {
                if (flag == false)return;
                var wait_dialog;
                $.ajax({
                    type: 'post',
                    dataType: 'json',
                    data: {ids: JSON.stringify(_ids)},
                    url: '<%=path%>/insurance/insPlcAppr/removeByIds.do',
                    beforeSend: function () {
                        wait_dialog = $.ligerDialog.SQalert({
                            content: LogUtils.LOG_CMM_DATA_LOADING,
                            SQ_type: "waitting"
                        });
                    },
                    success: function (msg) {
                        wait_dialog.close();
                        if (msg.success == 1) {
                            $.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                            grid.reload();
                        } else {
                            $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                        }
                    }
                });
            });
        });

    });

</script>

</body>
</html>
